Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luau-analyze: Add support for reading source code from stdin #325

Merged
merged 5 commits into from
Jan 25, 2022

Conversation

vladmarica
Copy link
Contributor

This PR adds support for passing in Lua source code into luau-analyze through stdin by running the program using
luau-analyze -.

Examples:

$ echo "print(x)" | ./luau-analyze -
stdin(1,7): TypeError: Unknown global 'x'

Also works when the stdin input is multiple lines:

$ echo -e "local x = 1\nlocal z = x + y" | ./luau-analyze -
stdin(2,15): TypeError: Unknown global 'y'
stdin(2,7): LocalUnused: Variable 'z' is never used; prefix with '_' to silence

Tested on Windows 10 and Debian Bullseye.

Closes #318

CLI/Analyze.cpp Outdated Show resolved Hide resolved
CLI/Analyze.cpp Outdated Show resolved Hide resolved
CLI/FileUtils.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@zeux zeux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@zeux zeux merged commit 4b96f7e into luau-lang:master Jan 25, 2022
@lopi-py
Copy link

lopi-py commented Jan 27, 2022

Thanks I needed this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Analysis: add support for reading stdin
3 participants